# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=SDL

pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=1.2.15
pkgrel=3
pkgdesc="A library for portable low-level access to a video framebuffer, audio output, mouse, and keyboard (mingw-w64)"
arch=('any')
url="http://libsdl.org"
license=("LGPL")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc" "${MINGW_PACKAGE_PREFIX}-pkg-config")
depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs" "${MINGW_PACKAGE_PREFIX}-libiconv")
options=('staticlibs' 'strip')
source=("$url/release/SDL-$pkgver.tar.gz")
md5sums=('9d96df8417572a2afb781a7c4c811a85')

build() {
  mkdir -p "${srcdir}/build-${MINGW_CHOST}"
  cd "${srcdir}/build-${MINGW_CHOST}"
  "${srcdir}"/SDL-${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST}
  make
}

package() {
  mkdir -p "${pkgdir}${MINGW_PREFIX}/bin"

  cd "${srcdir}/build-${MINGW_CHOST}"
  make DESTDIR="$pkgdir" install
  sed -e "s|-mwindows||g" -i ${pkgdir}${MINGW_PREFIX}/lib/pkgconfig/sdl.pc
}
